/*
 * FXGL - JavaFX Game Library. The MIT License (MIT).
 * Copyright (c) AlmasB (almaslvl@gmail.com).
 * See LICENSE for details.
 */

package com.windea.study.kotlin.fxgl.sample.sandbox

import com.almasb.fxgl.app.*
import com.almasb.fxgl.dsl.*
import com.almasb.fxgl.ui.*
import javafx.application.*
import javafx.scene.paint.*
import javafx.scene.shape.*
import javafx.stage.*

/**
 * @author Almas Baimagambetov (almaslvl@gmail.com)
 */
class CustomApp : Application() {
	override fun start(stage: Stage) {
		GameApplication.customLaunch(GameApp(), stage)
	}
	
	class GameApp : GameApplication() {
		override fun initSettings(settings: GameSettings) {}
		
		override fun initGame() {
			FXGL.entityBuilder()
				.at(200.0, 200.0)
				.view(Circle(15.0, Color.BLUE))
				.buildAndAttach()
		}
		
		override fun initUI() {
			val btn = FXGLButton("HELLO")
			
			btn.setOnAction { e -> FXGL.getGameWorld().entities[0].translate(5.0, 5.0) }
			
			FXGL.addUINode(btn, 100.0, 100.0)
		}
	}
}

fun main(args: Array<String>) {
	System.setProperty("os.target", "ios")
	System.setProperty("os.name", "iOS")
	System.setProperty("glass.platform", "ios")
	System.setProperty("targetos.name", "iOS")
	Application.launch(CustomApp::class.java, *args)
}
